using GroupSix.Domain.Entity.App;

namespace GroupSix.Domain.Repositories;

public interface IUserRepository : IRepository<GsUser>
{
    Task<GsUser?> GetByUsernameAsync(string username);
    Task<GsUser?> GetByEmailAsync(string email);
    Task<bool> IsUsernameExistsAsync(string username);
    Task<bool> IsEmailExistsAsync(string email);
    
    /// <summary>
    /// 获取用户角色关联
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <returns>用户角色关联列表</returns>
    Task<List<GsUserRole>> GetUserRolesAsync(Guid userId);
    
    /// <summary>
    /// 根据角色ID获取用户角色关联
    /// </summary>
    /// <param name="roleId">角色ID</param>
    /// <returns>用户角色关联列表</returns>
    Task<List<GsUserRole>> GetUserRolesByRoleIdAsync(Guid roleId);
    
    /// <summary>
    /// 分配用户角色
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="userRoles">用户角色关联列表</param>
    /// <returns></returns>
    Task AssignRolesAsync(Guid userId, List<GsUserRole> userRoles);
    
    /// <summary>
    /// 更新用户角色
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="userRoles">用户角色关联列表</param>
    /// <returns></returns>
    Task UpdateUserRolesAsync(Guid userId, List<GsUserRole> userRoles);
    
    /// <summary>
    /// 更新用户角色关联列表
    /// </summary>
    /// <param name="userRoles">用户角色关联列表</param>
    /// <returns></returns>
    Task UpdateUserRolesAsync(List<GsUserRole> userRoles);
} 